home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / jigsaw / jigsaw.bas < prev    next >
BASIC Source File  |  1995-05-09  |  1KB  |  36 lines

  1. DefInt A-Z
  2.  
  3. Declare Function GetSystemMenu Lib "User" (ByVal Hwnd, ByVal bRevert)
  4. Declare Function RemoveMenu Lib "User" (ByVal hMenu, ByVal nPosition, ByVal wFlags)
  5.  
  6. Const MF_BYPOSITION = &H400
  7.  
  8. ' Modal dialog boxes usually do not have a System menu or if
  9. ' they do, they consist of only MOVE and CLOSE options.  This
  10. ' routine is called when a Modal dialog box is about to be
  11. ' displayed, to remove all but the MOVE and CLOSE options
  12. ' from the forms system menu.  IconWorks has only two Modal
  13. ' dialog boxes: About and SaveFileDlg
  14. '
  15. Sub Remove_Items_From_Sysmenu (A_Form As Form)
  16.  
  17.     ' Obtain the handle to the forms System menu
  18.     '
  19.     HSysMenu = GetSystemMenu(A_Form.Hwnd, 0)
  20.   
  21.     ' Remove all but the MOVE and CLOSE options.  The menu items
  22.     ' must be removed starting with the last menu item to prevent
  23.     ' the menu items from taking on new position values as other
  24.     ' menu items are being removed.
  25.     '
  26.     R = RemoveMenu(HSysMenu, 8, MF_BYPOSITION) 'Switch to
  27.     R = RemoveMenu(HSysMenu, 7, MF_BYPOSITION) 'Separator
  28.     R = RemoveMenu(HSysMenu, 5, MF_BYPOSITION) 'Separator
  29.     R = RemoveMenu(HSysMenu, 4, MF_BYPOSITION) 'Maximize
  30.     R = RemoveMenu(HSysMenu, 3, MF_BYPOSITION) 'Minimize
  31.     R = RemoveMenu(HSysMenu, 2, MF_BYPOSITION) 'Size
  32.     R = RemoveMenu(HSysMenu, 0, MF_BYPOSITION) 'Restore
  33.  
  34. End Sub
  35.  
  36.